﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace HengTong.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class 物料变更申请新增附件 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "AttachmentId",
                table: "SysMaterialChangeRequestBill",
                type: "uniqueidentifier",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_SysMaterialChangeRequestBill_AttachmentId",
                table: "SysMaterialChangeRequestBill",
                column: "AttachmentId");

            migrationBuilder.AddForeignKey(
                name: "FK_SysMaterialChangeRequestBill_FileAttachments_AttachmentId",
                table: "SysMaterialChangeRequestBill",
                column: "AttachmentId",
                principalTable: "FileAttachments",
                principalColumn: "ID",
                onDelete: ReferentialAction.Restrict);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_SysMaterialChangeRequestBill_FileAttachments_AttachmentId",
                table: "SysMaterialChangeRequestBill");

            migrationBuilder.DropIndex(
                name: "IX_SysMaterialChangeRequestBill_AttachmentId",
                table: "SysMaterialChangeRequestBill");

            migrationBuilder.DropColumn(
                name: "AttachmentId",
                table: "SysMaterialChangeRequestBill");
        }
    }
}
